#!/bin/sh

PREFIX=/opt/spice
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:$PKG_CONFIG_PATH
export PATH=$PREFIX/bin/x86_64:$PREFIX/bin:$PATH

RK3188_CFLAG=-DRK3188
RK3188_CPPFLAG=-DRK3188
RK3188_LDFLAG="-lrkjpeg -lgtk-x11-2.0"


./configure --build=x86_64-linux-gnu --host=arm-linux-gnueabihf CFLAGS="-I$PREFIX/include $RK3188_CFLAG -O2"  CPPFLAGS="-I$PREFIX/include $RK3188_CPPFLAG -O2"  LDFLAGS="-L$PREFIX/lib -Wl,-rpath-link,$PREFIX/lib $RK3188_LDFLAG" --prefix=$PREFIX --with-gtk=2.0 --with-x11 --with-audio=gstreamer --enable-usbredir=yes --enable-smartcard=yes --enable-lz4=yes --with-coroutine=gthread
if [ $? -ne 0 ]; then
	exit 1
fi

make clean
make -j4
if [ $? -ne 0 ]; then
	exit 1
fi

